package com.zs.rocketmqstream.functional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

/**
 * @author madison
 * @description
 * @date 2021/7/5 16:09
 */
@RestController
public class FunController {

    @Autowired
    private StreamBridge streamBridge;

    @GetMapping("/")
    @ResponseStatus(HttpStatus.ACCEPTED)
    public void delegateToSupplier(@RequestParam(required = false,defaultValue = "默认msg") String msg) {
        System.out.printf("Sending func msg: %s%n ", msg);
        streamBridge.send("myFuncOutput-out-0", msg);
    }
}
